//
//  ForgetPasswordViewController.m
//  PlayerWorld
//
//  Created by 1 on 16/5/16.
//  Copyright © 2016年 刘成. All rights reserved.
//
#define UISCREEN_WIDTH  [UIScreen mainScreen].bounds.size.width
#define UISCREEN_HEIGHT [UIScreen mainScreen].bounds.size.height

#import "ForgetPasswordViewController.h"
#import "ForgetPasswordTwoViewController.h"
@interface ForgetPasswordViewController ()<UITextFieldDelegate>

@end

@implementation ForgetPasswordViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationItem.backBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"" style:UIBarButtonItemStylePlain target:self action:nil];
    self.title = @"找回密码";
    self.view.backgroundColor = [UIColor groupTableViewBackgroundColor];
    self.navigationController.navigationBarHidden = NO;
    
    // 状态栏(statusbar)
    CGRect rectStatus = [[UIApplication sharedApplication] statusBarFrame];
    
    // 导航栏（navigationbar）
    CGRect rectNav = self.navigationController.navigationBar.frame;
    
    UILabel *setUpMoneyPasswordLabel = [[UILabel alloc]initWithFrame:CGRectMake(0, rectStatus.size.height+rectNav.size.height+20, UISCREEN_WIDTH, 40)];
    setUpMoneyPasswordLabel.text = @"      用户名";
    setUpMoneyPasswordLabel.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:setUpMoneyPasswordLabel];
    
    UITextField *setUpMoneyPasswordTextField = [[UITextField alloc]initWithFrame:CGRectMake(100, CGRectGetMinY(setUpMoneyPasswordLabel.frame)+5, UISCREEN_WIDTH-100, 30)];
    setUpMoneyPasswordTextField.returnKeyType = UIReturnKeyDone;  //返回按钮的样式
    setUpMoneyPasswordTextField.clearButtonMode = YES; //清除模式开启
    setUpMoneyPasswordTextField.secureTextEntry = YES; //密码输入框
    //tf.keyboardType = UIKeyboardTypeNumberPad; //键盘类型
    //协议执行者交给textField自己self
    setUpMoneyPasswordTextField.delegate = self;
    [self.view addSubview:setUpMoneyPasswordTextField];
    
    
    UILabel *setUpMoneyPasswordLabel2 = [[UILabel alloc]initWithFrame:CGRectMake(0, CGRectGetMaxY(setUpMoneyPasswordLabel.frame)+1, UISCREEN_WIDTH, 40)];
    setUpMoneyPasswordLabel2.text = @"      验证码";
    setUpMoneyPasswordLabel2.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:setUpMoneyPasswordLabel2];
    
    UITextField *setUpMoneyPasswordTextField2 = [[UITextField alloc]initWithFrame:CGRectMake(100, CGRectGetMinY(setUpMoneyPasswordLabel2.frame)+5, UISCREEN_WIDTH-100, 30)];
    setUpMoneyPasswordTextField2.returnKeyType = UIReturnKeyDone;  //返回按钮的样式
    setUpMoneyPasswordTextField2.clearButtonMode = YES; //清除模式开启
    setUpMoneyPasswordTextField2.secureTextEntry = YES; //密码输入框
    //tf.keyboardType = UIKeyboardTypeNumberPad; //键盘类型
    //协议执行者交给textField自己self
    setUpMoneyPasswordTextField2.delegate = self;
    [self.view addSubview:setUpMoneyPasswordTextField2];
    
    
    UIButton *setUpMoneyPasswordButton = [[UIButton alloc]initWithFrame:CGRectMake(20, CGRectGetMaxY(setUpMoneyPasswordLabel2.frame)+20, UISCREEN_WIDTH-20-20, 40)];
    [setUpMoneyPasswordButton addTarget:self action:@selector(setUpMoneyPasswordButtonAction:) forControlEvents:UIControlEventTouchUpInside];
    [setUpMoneyPasswordButton setTitle:@"下一步" forState:UIControlStateNormal];
    [setUpMoneyPasswordButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    setUpMoneyPasswordButton.backgroundColor = [UIColor colorWithRed:46/255.0f green:168/255.0f blue:289/255.0f alpha:1];
    [self.view addSubview:setUpMoneyPasswordButton];

}

- (void)setUpMoneyPasswordButtonAction:(UIButton *)sender {
    
    ForgetPasswordTwoViewController *fPTVC= [[ForgetPasswordTwoViewController alloc] init];
    [self.navigationController pushViewController:fPTVC animated:YES];
    
}

//UITextField控件协议方法：当点击返回按钮时方法执行
-(BOOL)textFieldShouldReturn:(UITextField *)textField{
    [textField resignFirstResponder];
    return YES;
}

@end
